package com.hls.mvc.servlet.view;

import java.util.Map;

public class InternalResourceViewResolver {
    private String prefix;
    private String suffix;
    public InternalResourceViewResolver(String prefix,String suffix)
    {
        this.prefix = prefix;
        this.suffix = suffix;
    }
    /**
     * get the real jsp page location
     * @param requestPath
     * @param springMappings
     * @return
     */
    public String getJspLocation(String requestPath,Map<String,String> mappings)
    {
        
        requestPath = requestPath.split("\\.")[0];
        String realPath = mappings.get(requestPath);
        if(realPath==null)
        {
            System.out.println("can not find the mapping.");
            return "";
        }
        else
        {
            return this.prefix + realPath + this.suffix;
        }
        
    }
}
